package com.autotest0613;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.List;

/**
 * @author vivi
 * @description
 * @date 2024/6/14
 */

public class FirstAutotest {
    // 百度网址搜索吴世勋
//    public void man() throws InterruptedException {
//        ChromeDriver driver = new ChromeDriver();
//        driver.get("https://www.baidu.com");
//        Thread.sleep(3000);
//        driver.findElement(By.cssSelector("#kw")).sendKeys("吴世勋");
//        Thread.sleep(3000);
//        driver.findElement(By.cssSelector("#su")).click();
//        Thread.sleep(3000);
//        driver.quit();
//    }

    public void methodTest() {
        ChromeDriver driver = new ChromeDriver();
        driver.get("https://www.baidu.com");
//        driver.findElement(By.cssSelector("#kw"));
//        List<WebElement> eles = driver.findElements(By.className("hotsearch-item"));
//        for (WebElement ele : eles) {
//            System.out.println(ele.getText());
//        }

        // 元素的定位
        // 选择器selector
        driver.findElement(By.cssSelector("#kw"));

        driver.quit();
    }

}

















